package com.ksd.pug.controller.article;

import com.ksd.pug.controller.APIBaseController;
import com.ksd.pug.service.article.ArticleServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: hcl
 * @date: 2022/3/31 11:21
 * @Description:
 */
@RestController
@Slf4j
class ArticleRedisControler extends APIBaseController {

    @Autowired
    ArticleServiceImpl articleService;

    /**
     * 文章点赞
     *
     * @return
     */
    @PostMapping("/article/zan/like/{articleid}")
    public int articleZanPlus(@PathVariable("articleid") Long articleId){
        return articleService.articleZanPlus(articleId);
    }

    /**
     * 文章取消点赞
     *
     * @return
     */
    @PostMapping("/article/zan/unlike/{articleid}")
    public int articleZanMius(@PathVariable("articleid") Long articleId){
        return articleService.articleZanMius(articleId);
    }

    /**
     * 文章收藏
     *
     * @return
     */
    @PostMapping("/article/collect/like/{articleid}")
    public int articleCollectPlus(@PathVariable("articleid") Long articleId){
        return articleService.articleCollectPlus(articleId);
    }

    /**
     * 文章取消收藏
     *
     * @return
     */
    @PostMapping("/article/collect/unlike/{articleid}")
    public int articleCollectMius(@PathVariable("articleid") Long articleId){
        return articleService.articleCollectMius(articleId);
    }
}
